using System;
using System.IO;

namespace Utils
{
public static class Global
{
	public const string REALM = "demo";
	public const string CLIENT_ID = "admin-client";	// For SCOPE, add user role.
	public const string CLIENT_SECRET = "";
	public const string USERNAME_FOR_KEYCLOAK = "stian"; // For Role-Mappings, add view-users of the realm-management client.
	public const string PASSWORD_FOR_KEYCLOAK = "password";
	public const string SUB_URL_FOR_TOKEN = "/protocol/openid-connect/token"; // 1.3.1
}
public static class Logger
{
	static object SpinLock = new object();

	public static void log(string msg)
	{
		lock(SpinLock)
		{
			string path = System.Web.HttpContext.Current.Server.MapPath("./logs/");
			if(!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
			}
			StreamWriter sw = File.AppendText(path + DateTime.Now.ToString("yyyyMMdd") + ".log");
			sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")+","+msg);
			sw.Close();
		}
	}
}
}